Safe Java Native Interface
نویسندگان
چکیده
Type safety is a promising approach to enhancing software security. Programs written in type-safe programming languages such as Java are type-safe by construction. However, in practice, many complex applications are heterogeneous, i.e., they contain components written in different languages. The Java Native Interface (JNI) allows type-safe Java code to interact with unsafe C code. When a type-safe language interacts with an unsafe language in the same address space, in general, the overall application becomes unsafe. In this work, we propose a framework called Safe Java Native Interface (SafeJNI) that ensures type safety of heterogeneous programs that contain Java and C components. We identify the loopholes of using JNI that would permit C code to bypass the type safety of Java. The proposed SafeJNI system fixes these loopholes and guarantees type safety when native C methods are called. The overall approach consists of (i) retro-fitting the native C methods to make them safe, and (ii) developing an enhanced system that captures additional invariants that must be satisfied to guarantee safe interoperation. The SafeJNI framework is implemented through a combination of static and dynamic checks on the C code. We have measured our system’s effectiveness and performance on a set of benchmarks. During our experiments on the Zlib open source compression library, our system identified one vulnerability in the glue code between Zlib and Java. This vulnerability could be exploited to crash a large number of commercially deployed Java Virtual Machines (JVMs). The performance impact of SafeJNI on Zlib, while considerable, is less than reimplementing the C code ∗To appear in IEEE International Symposium on Secure Software Engineering, March 2006. This research was supported in part by ARDA award NBCHC030106. This information does not necessarily reflect the opinion or policy of the federal government and no official endorsement should be inferred. ‡ Daniel Wang is currently at Microsoft Corporation. in Java.
منابع مشابه
Quarantine: Java Heap Protection in the Presence of Native Code
By using Java Native Interface (JNI), programmers can integrate Java programs with legacy systems or third-party libraries written in other languages (e.g., C, C++, and Pascal). However, the use of JNI may violate Java type safety feature because these native programs are not type-safe. As a result, such integration can cause memory errors that can be difficult to isolate. In this paper, we pro...
متن کاملSafe and Efficient Hardware Specialization of Java Applications
Providing Java applications with access to low-level system resources, including fast network and I/O interfaces, requires functionality not provided by the Java Virtual Machine instruction set. Currently, Java applications obtain this functionality by executing code written in a lower-level language, such as C, through a native method interface. However, the overhead of this interface can be v...
متن کاملAutomated and Portable Native Code Isolation
The coexistence of programs written in a safe language with user-supplied unsafe (native) code is convenient (it enables direct access to hardware and operating system resources and can improve application performance), but at the same time it is problematic (it leads to undesirable interference with the language runtime, decreases overall reliability, and lowers debuggability). This work aims ...
متن کاملCreating Java to Native Code Interfaces with Janet
As Java is being considered an appropriate environment for high performance computing, the interest arises in combining it with existing code written in other languages. Portable Java to native code interfaces may be developed using the Java Native Interface (JNI). However, as a low-level API it is rather inconvenient to be used directly thus the higher level tools and techniques are desired. W...
متن کاملConvenient use of legacy software in Java with Janet package
This paper describes Janet package — highly expressive Java language extension that enables convenient creation of powerful native methods and efficient Java-to-native code interfaces. Java native interface (JNI) is a low-level API that is rather inconvenient if used directly. Therefore Janet, as the higher-level tool, combines flexibility of JNI with Java’s ease-of-use. Performance results of ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2006